﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Intorise.Common;
using Model;
using Config;
using Intorise.Net;

namespace MuBot
{
    static class Program
    {
        public static MainConfig AppConfig { get; private set; }

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            SaveCompleteHelper helper = null;
            Form.CheckForIllegalCrossThreadCalls = false;
            System.Net.ServicePointManager.Expect100Continue = false;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            //form = new MainForm();
            //Application.Run(form);

            ConfigManager.ApplicationConfig = new MainConfig();
            ConfigManager.BusinessConfig = new BotConfig();
            ConfigManager.Init();

            //for (var i = 0; i < 100; i++)
            //{
            //    ConsoleBLL.WriteInfo(GameHelper.GetName() + "\t");
            //}
            //Console.ReadLine();
            //return;

            Application.Run(new MainWindow(args));
            // Application.Run(new CreateCharacterWindow());
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            ConsoleBLL.WriteLineError("出现未捕获的异常：\r\n" + e.ExceptionObject.ToString() + "\r\n" + e.ExceptionObject.GetType().FullName);
        }
    }
}
